﻿
Partial Class shopClose
    Inherits System.Web.UI.Page
    Private dt As System.Data.DataTable

    Protected Sub btn_back_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_back.Click
        Server.Transfer("pukl_Auto.aspx")
    End Sub

    Protected Sub btn_summit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_summit.Click
        Dim ok As Boolean
        Dim sc As shopCar
        sc = CType(Session("shopCar"), shopCar)
        If (sc Is Nothing) Then
            Exit Sub
        End If
        Dim carList As System.Collections.Generic.List(Of String)
        carList = sc.GetValues()
        ok = Utility.ShopingClose(txt_contact.Text, txt_contact_tel.Text, _
                                  txt_contact_tel2.Text, carList)
        Session.Clear()
        Server.Transfer("pukl_Auto.aspx")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Not IsPostBack) Then
            GetData()
        End If
    End Sub

    Protected Sub GetData()
        Dim sbPU, sbCar As New StringBuilder
        Dim strSplit As Char() = New [Char]() {"$"}
        Dim idCollect As String()

        Dim sc As shopCar
        sc = CType(Session("shopCar"), shopCar)
        If (sc Is Nothing) Then
            Exit Sub
        End If
        Dim carList As System.Collections.Generic.List(Of String)
        carList = sc.GetValues()
        For Each Str As String In carList
            idCollect = Str.Split(strSplit)
            sbPU.AppendFormat(",'{0}'", idCollect(0).Trim())
            sbCar.AppendFormat(",'{0}'", idCollect(1).Trim())
        Next
        dt = Utility.GetSeleShopList( _
                        sbPU.ToString.Substring(1), _
                        sbCar.ToString.Substring(1))
        GV1.DataSource = dt
        GV1.DataBind()
    End Sub
End Class
